<?php

use think\migration\Migrator;
use think\migration\db\Column;

class InsertGather extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('gathers', array('engine' => 'MyISAM', 'comment' => '数据采集表'));
        $table
            ->addColumn('transfer', 'string', array('limit' => 155, 'null' => true, 'comment' => '转让费'))
            ->addColumn('wage', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '月工资'))
            ->addColumn('welfare', 'string', array('limit' => 255, 'null' => true, 'comment' => '生活福利'))
            ->addColumn('bonus', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '奖金'))
            ->addColumn('power_rate', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '电费'))
            ->addColumn('water_rate', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '水费'))
            ->addColumn('gas_rate', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '燃气费'))
            ->addColumn('heating_rate', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '取暖费'))
            ->addColumn('property_fee', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '物业费'))
            ->addColumn('decoration', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '装修成本'))
            ->addColumn('procurement', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '采购成本'))
            ->addColumn('operating', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '营运费用'))
            ->addColumn('other', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '其他费用'))
            ->addColumn('annual_turnover', 'decimal', array('precision' => 5, 'scale' => 2, 'null' => true, 'comment' => '年营业额'))
            ->addColumn('main_camp', 'text', array('null' => true, 'comment' => '所在商圈主营内容'))
            ->addColumn('business_circle_level', 'integer', array('limit' => 11, 'null' => true, 'comment' => '商圈级别'))
            ->addColumn('property_of_business_circle', 'string', array('limit' => 255, 'null' => true, 'comment' => '商圈属性'))
            ->addColumn('life_cycle', 'string', array('limit' => 255, 'null' => true, 'comment' => '商圈生命周期'))
            ->addColumn('greening_environment', 'string', array('limit' => 255, 'null' => true, 'comment' => '商圈绿化环境'))
            ->addColumn('property_environment', 'string', array('limit' => 255, 'null' => true, 'comment' => '物业环境'))
            ->addColumn('infrastructure', 'string', array('limit' => 255, 'null' => true, 'comment' => '道路基础建设'))
            ->addColumn('unit_price', 'string', array('limit' => 255, 'null' => true, 'comment' => '消费客单价'))
            ->addColumn('passenger_flow', 'string', array('limit' => 255, 'null' => true, 'comment' => '目标客流量'))
            ->addColumn('consumption_ability', 'text', array('null' => true, 'comment' => '常住住户的消费能力'))
            ->addColumn('number_of_bus_stops', 'integer', array('limit' => 11, 'null' => true, 'comment' => '公交站数量个'))
            ->addColumn('number_of_lines', 'integer', array('limit' => 11, 'null' => true, 'comment' => '公交车线路数量'))
            ->addColumn('number_of_parking_lots', 'integer', array('limit' => 11, 'null' => true, 'comment' => '停车场数量'))
            ->addColumn('is_metro', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '地铁有无'))
            ->addColumn('main_road_length', 'string', array('limit' => 100, 'null' => true, 'comment' => '主干道路长'))
            ->addColumn('width_of_main_road', 'string', array('limit' => 100, 'null' => true, 'comment' => '主干道路宽'))
            ->addColumn('road_is_unobstructed', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '主干道是否通畅'))
            ->addColumn('sidewalk', 'string', array('limit' => 100, 'null' => true, 'comment' => '店前人行道宽'))
            ->addColumn('sidewalk_is_unobstructed', 'boolean', array('limit' => 1, 'default' => 1, 'comment' => '人行道是否通畅'))
            ->addColumn('number_of_main_stores', 'string', array('limit' => 100, 'null' => true, 'comment' => '商圈内主力店数（并记录）'))
            ->addColumn('brand_store_number', 'string', array('limit' => 100, 'null' => true, 'comment' => '商圈内品牌店数（并记录）'))
            ->addColumn('recreation', 'string', array('limit' => 100, 'null' => true, 'comment' => '商圈内休闲娱乐场所数（并记录）'))
            ->addColumn('number_of_competing_stores', 'text', array('null' => true, 'comment' => '商圈内同业竞争店数（并记录）'))
            ->save();
    }
}
